package com.sirun.cn.fca.module.main.home.temp.control;

import android.support.annotation.NonNull;

import com.sirun.cn.fca.module.main.home.temp.repo.ControlPollingResponse;
import com.sirun.cn.fca.module.main.home.temp.repo.ControlRepository;
import com.sirun.cn.fca.module.main.home.temp.repo.ControlRequest;
import com.sirun.cn.fca.module.main.home.temp.repo.ControlResponse;
import com.tencent.cloud.iov.flow.loader.impl.BaseFlowLoader;
import com.tencent.cloud.iov.kernel.model.BaseResponse;

import io.reactivex.Observable;
import io.reactivex.schedulers.Schedulers;

public class ControlLoader extends BaseFlowLoader<String> {
    @NonNull
    @Override
    protected Observable<String> getDataObservable() {
        String initInfo = "init control activity";
        return Observable.just(initInfo);
    }

    public Observable<BaseResponse<ControlResponse>> controlDoor(String din, ControlRequest request) {
        return ControlRepository.getInstance().controlDoor(din, request).subscribeOn(Schedulers.io());
    }

    public Observable<BaseResponse<ControlResponse>> controlEngine(String din, ControlRequest request) {
        return ControlRepository.getInstance().controlEngine(din, request).subscribeOn(Schedulers.io());
    }

    public Observable<BaseResponse<ControlResponse>> controlBeer(String din, ControlRequest request) {
        return ControlRepository.getInstance().controlBeer(din, request).subscribeOn(Schedulers.io());
    }

    public Observable<BaseResponse<ControlResponse>> controlCar(String type, String din, ControlRequest request) {
        return ControlRepository.getInstance().controlCar(type, din, request).subscribeOn(Schedulers.io());
    }

    public Observable<BaseResponse<ControlPollingResponse>> controlPolling(String din, String platformResponseId) {
        return ControlRepository.getInstance().controlPolling(din, platformResponseId).subscribeOn(Schedulers.io());
    }


}
